package com.example.crm01.controller;

import com.example.crm01.entity.user;
import com.example.crm01.service.UserService;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    private UserService userService;

    /*登录*/
    @PostMapping("/login")
    public boolean login(@RequestBody user loginUser){
        user user = userService.getUserByUsername(loginUser.getUsername());

        return user != null && user.getPassword().equals(loginUser.getPassword());

    }
}
